//
//  AppDelegate.swift
//  iOSProject-XX
//
//  Created by LeeXu on 2020/7/16.
//

import UIKit
import iVersion
import Alamofire

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window:UIWindow?
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window?.backgroundColor = .white
        self.window?.rootViewController = TestViewController(style: .plain)
        self.window?.makeKeyAndVisible()
        
        
        let reachability = NetworkReachabilityManager()
        reachability?.startListening()
        reachability?.listener = { [weak self] status in
            
            
            
            
        }
        
        
   
        
        
        checkUpdate()
        return true
    }
    
    func applicationWillResignActive(_ application: UIApplication) {
       
    }

    func applicationDidEnterBackground(_ application: UIApplication) {
      
    }

    func applicationWillEnterForeground(_ application: UIApplication) {
        
        
    }

    func applicationDidBecomeActive(_ application: UIApplication) {
        
    }

}



extension AppDelegate {

    func checkUpdate() {
         iVersion.sharedInstance()?.updateAvailableTitle = "有新版本发布"
         iVersion.sharedInstance()?.okButtonLabel = "升级"
         iVersion.sharedInstance()?.ignoreButtonLabel = "忽略"
         iVersion.sharedInstance()?.remindButtonLabel = "稍后提醒"
    }
}

